<?php
$postdata = http_build_query(
    array(
        'input_date' => '100/03/21',
        'select2' => 'ALL',
        'order' => 'STKNO'
    )
);

$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);

$context  = stream_context_create($opts);

$homepage = file_get_contents('http://www.twse.com.tw/ch/trading/exchange/BWIBBU/BWIBBU_d.php', false, $context);

/*$pos_start=strpos($homepage,"<div id='tbl-containerx'>");
$pos_start=strpos($homepage,"<div id='tbl-containerx'>",$pos_start+1);
$pos_end=strpos($homepage,"</div>",$pos_start+1);
$pos_end=strpos($homepage,"</div>",$pos_end+1);*/

$pos_start=  strpos($homepage, "<table width=590 border=0 align=center cellpadding=0 cellspacing=0>");
$pos_end = strpos($homepage,"</table>",$pos_start+1);

$html=substr($homepage,$pos_start,$pos_end-$pos_start);

$html=substr_replace($html, "id='stk_info_list' ", 7 , 0);

?>
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=BIG5">
    <script type="text/javascript" src="./general/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" language="javascript1.2" src="./general/GetYield.js"></script>
  </head>
  <body onload="evt_page_load();">
      <div id="context">
      	<pre>
        	<?php echo $html?>
        </pre>
      </div>
      <div id="div_sql">

      </div>
  </body>
</html>
